<template>
  <div class="headerBar">
    <span>
      <slot name="back"></slot>
    </span>
    <h1>
     <slot> 猫眼电影 </slot>
    </h1>
    <span @click.stop="handleClick()">
      <van-icon name="coupon-o"  />
    </span>

    <ul class="menu" v-show="$store.state.showMenu">
      <li>
        首页
      </li>
      <li>
        榜单
      </li>
      <li @click="go('/home/my')">
        我的
      </li>
    </ul>

  </div>
</template>

<script>
export default {
  

methods:{
  handleClick(){
    this.$store.commit('setMenu',true)
  },
  go(path){
    this.$router.push(path)
    this.$store.commit('setMenu',false)
  }
}

}
</script>



// scoped :私有样式
<style lang="scss" scoped>
.headerBar {
  height: 50.5px;
  background: #e54847;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  

  h1 {
    font-size: 18px;
    font-weight: 200;
    flex: 1;
    text-align: center;
  }
  span {
    width: 30px;
  }

  .menu{
    width: 100px;
    position: absolute;
    z-index: 900;
    right: 5px;
    top:30px;
    background: white;
    li {
      list-style: none;
      color:black;
    }
  }
}
</style>

